package com.hr.approval.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hr.approval.entity.ApprovalData;
import com.hr.approval.entity.param.ApprovalParam;
import com.hr.approval.entity.vo.ApprovalDataDisplay;
import com.hr.approval.entity.vo.ApprovalDataVO;
import com.hr.approval.entity.param.ApprovalPWhere;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author hr
 * @since 2024-05-07
 */
@Mapper
public interface ApprovalDataMapper extends BaseMapper<ApprovalData> {

    List<ApprovalData> queryData(ApprovalPWhere approvalPWhere);

    Long queryCounts(ApprovalPWhere approvalPWherea);

    List<ApprovalDataVO> getApproveDataByApproval(ApprovalParam approvalParam);

    @Update("update approval_data set state = #{state} +1 where id = #{id}")
    Integer agreeApprove(Integer id,Integer state);

    @Update("update approval_data set state = 5 where id = #{id}")
    Integer disagreeApprove(Integer id);

    ApprovalDataDisplay selectDataById(@Param("id") Integer id);
}
